<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <blockquote class="text-warning" style="font-size: 14px">
          雷达数据运营
        </blockquote>
        <hr />
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :sm="24" :lg="12" style="padding-left: 20px">
        <h2>雷达数据运营</h2>
        <p>
          一直想做一款后台管理系统
        </p>
        
        <p>
          <el-button
            type="primary"
            icon="Cloudy"
            plain
            @click="goTarget('https://www.baidu.com/')"
            >使用文档</el-button >
          <el-button
            icon="HomeFilled"
            plain
            @click="goTarget('https://www.baidu.com/')"
            >主页</el-button >
        </p>
      </el-col>

      <el-col :sm="24" :lg="12" style="padding-left: 50px">
        <el-row>
          <el-col :span="12">
            <h2>功能列表</h2>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <h4>111</h4>
            <ul>
              <li>111</li>
              <li>111</li>
           
            </ul>
          </el-col>
          <el-col :span="6">
            <h4>222</h4>
            <ul>
              <li>222</li>
              <li>222</li>
              <li>...</li>
            </ul>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <template v-slot:header>
            <div class="clearfix">
              <span>快速导航</span>
            </div>
          </template>
          <div class="body">
            <p>
              
              <el-link  type="primary"
                href="http://116.205.184.68:8080/index"
                target="_blank"
                >雷达数据运营 - HW</el-link>
            </p>
            <p>
         </p>
            
            
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <template v-slot:header>
            <div class="clearfix">
              <span>更新日志</span>
            </div>
          </template>
          <el-collapse accordion>
            <el-collapse-item title="3333">
                      <ol>
                        <li>33333333333</li>
                        <li>33333333333</li>
                        <li>33333333333</li>
                        <li>33333333333</li>
                        <li>33333333333</li>
                        <li>33333333333</li>
                        
                      </ol>
                    </el-collapse-item>
         </el-collapse>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <template v-slot:header>
            <div class="clearfix">
              <span> 内网访问 </span>
            </div>
          </template>
          <div class="body">
                内网地址: {{ openUrl }} 
                <vxe-button @click="copyOpenUrl">点击复制</vxe-button>

              <el-button
              type="primary"
              plain
              @click="goTarget(openUrl)"
              >内网访问</el-button >
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup name="Index">

import { localIP } from "@/api/login";
import { VxeUI } from 'vxe-pc-ui'
const openUrl = ref('')
const netIP = ref('')
const currentURL = ref('')

function goTarget(url) {
  window.open(url, '__blank')
}

function currentURLJson(){
    var currentURLJson = {
      href: window.location.href,
      protocol: window.location.protocol,
      host: window.location.host,
      hostname: window.location.hostname,
      port: window.location.port,
      pathname: window.location.pathname,
      search: window.location.search,
      hash: window.location.hash
  };
  currentURL.value = currentURLJson
}


function  loadLocalNetUrl(){
  localIP().then(response => {
    netIP.value = response.data.netIP;
    let protocol = window.location.protocol;
    let host =  netIP.value;
    let port =  window.location.port;
    let path = window.location.pathname;
    openUrl.value  = `${protocol}//${host}:${port}${path}`;
  });
}
loadLocalNetUrl()

const copyOpenUrl = () => {
  if (VxeUI.clipboard.copy(openUrl.value)) {
    VxeUI.modal.message({
      status: 'success',
      content: '复制成功',
      duration: 20000
    })
  }
}

</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>

